window.error || (error = {
    init: function () {
        var me = this;
        me.errorBottom = $(".error-bottom");
        me.bottom_radiusStr = ['<div class="radius {className}"></div>'].join('');
        me.bottom_radiusStrW = 214;
        me.errorBleg = Math.ceil(me.errorBottom.width() / me.bottom_radiusStrW);
        me.errorBw = me.errorBleg * me.bottom_radiusStrW;
        me.errorTitleText = $('.error-title .text');
        me.tipStatus = $('.tip-status');
        me.tipStatusLeft = me.tipStatus.find('.left');
        me.tipStatusCenter = me.tipStatus.find('.center');
        me.tipStatusRight = me.tipStatus.find('.right');
        me.tipStatusStatus = me.tipStatus.attr('data-status');
        me.errorTitleText.delay(500).animate({"top": 0, 'opacity': 1}, 300);
        me.tipStatusCenter.html(me.tipStatusStatus.slice(1, me.tipStatusStatus.length - 1)).delay(500).animate({
            "top": 0,
            'opacity': 1
        }, 250);
        me.tipStatusLeft.html(me.tipStatusStatus.slice(0, 1)).delay(1000).animate({"right": '100%', 'opacity': 1}, 150);
        me.tipStatusRight.html(me.tipStatusStatus.slice(me.tipStatusStatus.length - 1, me.tipStatusStatus.length)).delay(1000).animate({
            "left": '100%',
            'opacity': 1
        }, 150);
        $(".earth").delay(1500).animate({'bottom': -430},800,function () {
            $(this).animate({
                'bottom': -480
            },1000);
        });
        $(".pendant .radius").each(function (i) {
            $(this).delay(1000+(i*300)).fadeIn();
        });
        $(".pendant .icon-404cross").each(function (i) {
            $(this).delay(1200+(i*300)).fadeIn();
        });
        $(".pendant .icon-404circle").each(function (i) {
            $(this).delay(1100+(i*300)).fadeIn();
        });
    },
    RadiusIntv: null,
    setRadius: function () {
        var me = this;
        var rIdx = 1;
        var find=$("<div class='find'/>");
        me.errorBottom.html('');
        for (var i = 0; i < me.errorBleg; i++) {
            var bottom_radius = $(me.bottom_radiusStr.substitute({
                'className': 'radius-' + rIdx
            }));
            rIdx += 1;
            if (rIdx > 4) {
                rIdx = 1;
            }
            find.append(bottom_radius);
        }
        find.width(me.errorBw);
        me.errorBottom.append(find);
        me.errorBottom.append(find.clone().css('left',me.errorBw));
        me.errorBottomAnimate()
    },
    errorBottomAnimate:function () {
        var me=this;
        me.errorBottom.find(".find").each(function (i) {
            $(this).animate({"left": parseFloat($(this).css('left')) - me.errorBw },30000,'linear',function () {
                if(parseFloat($(this).css('left'))<= -me.errorBw){
                    $(this).css('left',me.errorBw);
                }
                if(i>=me.errorBottom.find(".find").length-1) {
                    me.errorBottomAnimate();
                }
            });
        });
    }
});
LeisuJS.load(['easing'],function () {
    window.error.init();

    $(window).resize(function () {
        window.error.setRadius();
    }).resize();
});
